
% Can anyone get circuitikz working with sphinx?

% Vanilla tikz was straightforward thanks to:
% https://bitbucket.org/philexander/tikz

\documentclass[10pt]{article}
%\usetheme[everytitleformat=uppercase]{m}

\usepackage{tikz}


\usepackage[europeanresistors,americaninductors]{circuitikz}

\begin{document}
\centering


%example of coupled buses
\begin{circuitikz}
  \draw (1.5,14.5) to [short,i^=$f_1$] (1.5,13);
  \draw [ultra thick] (0,13) node[anchor=south]{bus $m$} -- (4,13);
  \draw(2.5,13) |- +(0,0.5) to [short,i^=$f_2$] +(5,0.5) |- +(0,-0.5);
  \draw [ultra thick] (6,13) node[anchor=south]{bus $n$} -- +(4,0);
  \draw (8.5,14.5) to [short,i^=$f_3$] +(0,-1.5);
  \draw (0,-0.5) ;
  \draw (0.5,13) -- +(0,-0.5) node[sground]{};
  \draw (2,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (3.5,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (0.5,11) node{$d_m$};
  \draw (2,11) node{$g_{m,w}$};
  \draw (3.5,11) node{$g_{m,s}$};
  \draw (2,10.3) node{$g_{m,w} + g_{m,s} - d_m =  f_2 - f_1$};
  \draw (6.5,13) -- +(0,-0.5) node[sground]{};
  \draw (8,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (9.5,12) node[vsourcesinshape, rotate=270](V2){}
  (V2.left) -- +(0,0.6);
  \draw (6.5,11) node{$d_n$};
  \draw (8,11) node{$g_{n,w}$};
  \draw (9.5,11) node{$g_{n,s}$};
  \draw (8,10.3) node{$g_{n,w} + g_{n,s} - d_n =  - f_2 - f_3$};

\end{circuitikz}

\vspace{2cm}


%line PI
\begin{circuitikz}[scale=1.2]
  \draw
  (0,0)
  to [open, v>=$v_0$] (0,4)
  to [short,i^=$i_0$,o-*] (2,4)
  to [R=$\frac{y}{2}$, -*] (2,0)
  to [short,*-o] (0,0)

  (2,4)
  to [short] (3,4)
  to [R=$z$] (4,4)
  to [short] (5,4)
  to [R=$\frac{y}{2}$, -*] (5,0)
  to [short] (2,0)

  (5,0)
  to [short,*-o] (7,0)
  to [open, v^>=$v_1$] (7,4)
  to [short,i_=$i_1$,o-*] (5,4)
  ;
\end{circuitikz}

\vspace{2cm}

%transformer PI HV tap
\begin{circuitikz}[scale=1.2]

  \draw (-3,0)
  to [open, v>=$v_0$] (-3,4)
  to [short,i^=$i_0$,o-*] (-1,4) ;

  \draw (-1,0) to [short,*-o] (-3,0);


  \draw (-1,4 ) to [american inductor] (-1,0) ;

  \draw (0,0 ) to [american inductor] (0,4) ;

  \draw (-1.2,-0.5) node{$\tau e^{j\theta_{shift}} = N : 1$};

  \draw (0.8,2) node{$v_2 =  \frac{v_0}{N}$};

  \draw (1,4.2) node{$i_2 = N^*i_0$};

  \draw
  (0,0)
  to [open, v>=$$] (0,4)
  to [short,i^=$$,*-*] (2,4)
  to [R=$\frac{y}{2}$, -*] (2,0)
  to [short,*-*] (0,0)

  (2,4)
  to [short] (3,4)
  to [R=$z$] (4,4)
  to [short] (5,4)
  to [R=$\frac{y}{2}$, -*] (5,0)
  to [short] (2,0)

  (5,0)
  to [short,*-o] (7,0)
  to [open, v^>=$v_1$] (7,4)
  to [short,i_=$i_1$,o-*] (5,4)
  ;
\end{circuitikz}




%transformer T HV tap
\begin{circuitikz}[scale=1.2]

  \draw (-3,0)
  to [open, v>=$v_0$] (-3,4)
  to [short,i^=$i_0$,o-*] (-1,4) ;

  \draw (-1,0) to [short,*-o] (-3,0);


  \draw (-1,4 ) to [american inductor] (-1,0) ;

  \draw (0,0 ) to [american inductor] (0,4) ;


  \draw (-1.2,-0.5) node{$\tau e^{j\theta_{shift}} = N : 1$};

  \draw (0.8,2) node{$v_2 =  \frac{v_0}{N}$};

  \draw (1,4.2) node{$i_2 = N^*i_0$};

  \draw
  (0,0)
  to [open, v>=$$] (0,4)
  to [short,i^=$$,*-] (2,4)

  (2,4)
  to [R=$\frac{z}{2}$] (4,4)
  to [R=$y$, *-*] (4,0)
  to [short, *-*] (0,0)

  (4,0)
  to [short,*-o] (7,0)
  to [open, v^>=$v_1$] (7,4)
  to [short,i_=$i_1$,o-] (6,4)
  to [R=$\frac{z}{2}$] (4,4)
  ;
\end{circuitikz}





\vspace{2cm}

%transformer PI LV tap
\begin{circuitikz}[scale=1.2]

  \draw
  (0,0)
  to [open, v>=$v_0$] (0,4)
  to [short,i^=$i_0$,o-*] (2,4)
  to [R=$\frac{y}{2}$, -*] (2,0)
  to [short,*-o] (0,0)

  (2,4)
  to [short] (3,4)
  to [R=$z$] (4,4)
  to [short] (5,4)
  to [R=$\frac{y}{2}$, -*] (5,0)
  to [short] (2,0)

  (5,0)
  to [short,*-*] (7,0)
  to [open, v^>=$$] (7,4)
  to [short,i_=$$,*-*] (5,4)
  ;

  \draw (10,0)
  to [open, v>=$v_1$] (10,4)
  to [short,i^=$i_1$,o-*] (8,4) ;

  \draw (10,0) to [short,o-*] (8,0);


  \draw (8,0 ) to [american inductor] (8,4) ;

  \draw (7,4 ) to [american inductor] (7,0) ;

  \draw (8.3,-0.5) node{$1 : N^* = \tau e^{-j\theta_{shift}}$};

  \draw (6.3,2) node{$v_3 =  \frac{v_1}{N^*}$};

  \draw (6,4.2) node{$i_3 = Ni_1$};



\end{circuitikz}



%transformer T LV tap
\begin{circuitikz}[scale=1.2]

  \draw
  (0,0)
  to [open, v>=$v_0$] (0,4)
  to [short,i^=$i_0$,*-] (2,4)

  (2,4)
  to [R=$\frac{z}{2}$] (4,4)
  to [R=$y$, *-*] (4,0)
  to [short, *-*] (0,0)

  (4,0)
  to [short,*-o] (7,0)
  to [open, v^>=$$] (7,4)
  to [short,i_=$$,*-] (6,4)
  to [R=$\frac{z}{2}$] (4,4)
  ;


  \draw (10,0)
  to [open, v>=$v_1$] (10,4)
  to [short,i^=$i_1$,o-*] (8,4) ;

  \draw (10,0) to [short,o-*] (8,0);


  \draw (8,0 ) to [american inductor] (8,4) ;

  \draw (7,4 ) to [american inductor] (7,0) ;

  \draw (8.3,-0.5) node{$1 : N^* = \tau e^{-j\theta_{shift}}$};

  \draw (6.3,2) node{$v_3 =  \frac{v_1}{N^*}$};

  \draw (6.3,4.2) node{$i_3 = Ni_1$};



\end{circuitikz}


\end{document}
